package guda.stark.biz.form;

import guda.stark.dal.dataobject.ResourceDO;

import javax.validation.constraints.NotNull;


/**
 * Created by well on 15/11/7.
 */
public class ResourceEditForm extends ResourceForm{

    @NotNull(message = "不能为空")
    private Long resourceId;

    public void initForm(ResourceDO resourceDO){
        if(resourceDO == null){
            return ;
        }
        setResourceCat(resourceDO.getResourceCat());
        setResourceName(resourceDO.getResourceName());
        setResourceUrl(resourceDO.getResourceUrl());
        setResourceId(resourceDO.getResourceId());


    }

    public ResourceDO toDO() {
        ResourceDO resourceDO = super.toDO();
        resourceDO.setResourceId(resourceId);
        return resourceDO;
    }

    public Long getResourceId() {
        return resourceId;
    }

    public void setResourceId(Long resourceId) {
        this.resourceId = resourceId;
    }
}
